//引入App和CreateApp
import { createApp } from 'vue'
import App from '@/App.vue'
//引入UI组件库
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
//引入UI组件库国际化
//@ts-ignore
import zhCn from 'element-plus/es/locale/lang/zh-cn'
//引入暗黑模式需要的样式
import 'element-plus/theme-chalk/dark/css-vars.css'
//引入SVG
//@ts-ignore
import 'virtual:svg-icons-register'
//引入全局样式
import '@/styles/index.scss'
//引入路由
import router from './router'
//引入仓库
import pinia from './store'
//引入路由鉴权文件
import './permisstion'
//引入自定义指令
import { isHasButton } from '@/directive/has'
//引入自定义插件：globalComponent是一个全局对象
import globalComponent from '@/components/index.ts'

//声明app
const app = createApp(App)

//向自定义指令暴露的函数内部注入app实例
isHasButton(app)
//安装自定义插件：该对象内部注册了全部全局组件
app.use(globalComponent)
//安装UI组件库+实现国际化
app.use(ElementPlus, {
  locale: zhCn,
})
//安装路由
app.use(router)
//安装仓库
app.use(pinia)

//挂载app
app.mount('#app')
